<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>a的个数</title>
	</head>
	<body>
		<script type="text/javascript">
			
			var num=0;
			var a=["America","Greece","Britain","Canda","China","Egypt"];
			for (var i in a) {
				document.write(a[i]+"<br />");
				if(a[i].indexOf("a")!=-1||a[i].indexOf("A")!=-1){
					num++;
				}
				
			}
			document.write("共有"+num+"个字符串包含a或A")
		</script>
		
	</body>
</html>
